import pymysql
conn = pymysql.connect(host="127.0.0.1",
                       port=3306,
                       user="root",
                       password="root",
                       database="books",
                       charset="utf8",
                       autocommit=True)
cursor = conn.cursor()
sql = "insert into t_book(id,title,pub_date) values(4,'西游记','1986-01-01')"
cursor.execute(sql)
print(cursor.rowcount)
cursor.close()
conn.close()
